import { http } from './request.js'

export const rulesAPI = {
  // 提现规则
  withdraw: {
    getAll: () => http.secure.get('/rule/withdraw/list'),
    create: (data) => http.secure.post('/rule/withdraw/create', data),
    update: (id, data) => http.secure.put(`/rule/withdraw/update/${id}`, data),
    delete: (id) => http.secure.delete(`/rule/withdraw/delete/${id}`)
  },

  // 充值规则
  recharge: {
    getAll: () => http.secure.get('/rule/recharge/list'),
    create: (data) => http.secure.post('/rule/recharge/create', data),
    update: (id, data) => http.secure.put(`/rule/recharge/update/${id}`, data),
    delete: (id) => http.secure.delete(`/rule/recharge/delete/${id}`)
  },

  // 透支规则
  overdraft: {
    getAll: () => http.secure.get('/rule/overdraft/list'),
    create: (data) => http.secure.post('/rule/overdraft/create', data),
    update: (id, data) => http.secure.put(`/rule/overdraft/update/${id}`, data),
    delete: (id) => http.secure.delete(`/rule/overdraft/delete/${id}`)
  },

  // VIP等级
  vip: {
    getAll: () => http.secure.get('/rule/vip/list'),
    create: (data) => http.secure.post('/rule/vip/create', data),
    update: (id, data) => http.secure.put(`/rule/vip/update/${id}`, data),
    delete: (id) => http.secure.delete(`/rule/vip/delete/${id}`),
    init: () => http.secure.post('/rule/vip/init', {})
  }
}
